package entity;

public class PageBean {
    private int curPage;
    private int alterPage;
    private int startPage;
    private int endPage;
    private int pageCount;
    private int pageSize = 5;

    public PageBean(int curPage, int alterPage, int pageCount) {
        this.alterPage = alterPage;
        this.pageCount = pageCount;
        this.curPage = curPage+alterPage;
        if (this.curPage > pageCount) {
            this.curPage = pageCount;
        }
        if (this.curPage <= 0) {
            this.curPage = 1;
        }
        this.startPage=pageSize * ((this.curPage - 1) / pageSize) + 1;
        this.endPage=startPage + pageSize - 1;
        if (endPage > pageCount) {
            this.endPage = pageCount;
        }
    }

    public PageBean() {
        this.curPage = 1;
        this.alterPage = 0;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCurPage() {
        return curPage;
    }

    public void setCurPage(int curPage) {
        this.curPage = curPage;
    }

    public int getAlterPage() {
        return alterPage;
    }

    public void setAlterPage(int alterPage) {
        this.alterPage = alterPage;
    }

    public int getStartPage() {
        return startPage;
    }

    public void setStartPage(int startPage) {
        this.startPage = startPage;
    }

    public int getEndPage() {
        return endPage;
    }

    public void setEndPage(int endPage) {
        this.endPage = endPage;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }
}
